package com.guochenglang.www.dao;

import com.guochenglang.www.pojo.Likes;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface LikesDao {
    /**
     * 搜索点赞列表
     *
     * @param likes 搜索条件
     * @return 点赞列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Likes> likesSelect(Likes likes) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 分页获取点赞列表
     *
     * @param page  当前页码
     * @param num   每页显示个数
     * @param likes 搜素条件
     * @param order 排序条件
     * @param mode  升序还是降序
     * @return 点赞列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Likes> likesSelectByLimit(int page, int num, Likes likes, String order, String mode) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 添加点赞
     *
     * @param likes 点赞信息
     * @return 添加得到的键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int insertLikes(Likes likes) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 更新点赞
     *
     * @param set        更新数据
     * @param conditions 更新条件
     * @return 更新行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int updateLikes(Likes set, Likes conditions) throws SQLException, InterruptedException, IllegalAccessException;

    /**
     * 删除点赞
     *
     * @param conditions 删除条件
     * @return 删除个数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     */
    int deleteLikes(Likes conditions) throws SQLException, InterruptedException, IllegalAccessException;
}
